package Chapter2.Comparing.c8;

import java.io.*;

public class InputStreamReaderDemo {
    /*public static void main(String[] args) throws IOException {
        InputStream in = System.in;

        InputStreamReader isr = new InputStreamReader(in);

        BufferedReader br = new BufferedReader(isr);
        String string = null;

        while ((string = br.readLine())!=null) {
            if("over".equals(string)) {
                break;
            }
        }
        System.out.println(string.toUpperCase());
    }*/
    public static void main(String[] args) throws Exception {
        testMyInput();
    }

    public static void testMyInput() throws Exception{
        FileInputStream fis = new FileInputStream("Doc/a.txt");
        FileOutputStream fos = new FileOutputStream("Doc/a.txt");
        InputStreamReader isr = new InputStreamReader(fis,"GBK");
        OutputStreamWriter osw = new OutputStreamWriter(fos,"GBK");

        BufferedReader br = new BufferedReader(isr);
        BufferedWriter bw = new BufferedWriter(osw);

        String str = null;
        while((str = br.readLine())!=null) {
            bw.write(str);
            bw.newLine();
            bw.flush();
        }
        bw.close(); br.close();
    }



}
